package models

import (
	"demo/enum"
	"gorm.io/gorm"
	"time"
)

// User 用户模型
type User struct {
	Id        int            `gorm:"column:id"`
	Name      string         `gorm:"column:name" validate:"required"`
	Age       int            `gorm:"column:age"`
	Phone     string         `column:"phone"`
	Sex       enum.SexEnum   `column:"sex"`
	UserName  string         `gorm:"column:user_name"`
	Password  string         `column:"password"`
	CreatedAt time.Time      `gorm:"column:created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"index column:deleted_at"`
	DeptId    int            `gorm:"column:dept_id"`
}

// TableName 指定表名
func (u *User) TableName() string {
	return "user"
}
